#include <xcb/xcb.h>
#include <xcb/xcb_keysyms.h>

namespace uic
{

class UIC_Xcb : public GUIWindow
    {
    friend class CairoUI;
  public:
    UIC_Xcb();
    ~UIC_Xcb();

    cairo_t *get_cairo(CairoUI *ui);
    void resized(CairoUI *ui);
    void set_title(const char *str);

  protected:
    void process_input(CairoUI *ui, int fd);
    void fd_exception(CairoUI *ui, int fd);
    void perform_flush(CairoUI *ui);

    bool activate(CairoUI *ui);
    bool active();
    void move(int new_x, int new_y);

  private:
    void key_press(CairoUI *ui, xcb_key_press_event_t *ev);
    void set_wm_icon(CairoUI *ui);
    void set_net_wm_icon(CairoUI *ui);

    xcb_connection_t  *c;
    xcb_screen_t      *screen;
    int                screen_number;
    xcb_window_t       window;
    xcb_key_symbols_t *keysyms;
    cairo_surface_t   *surface;

    // for reading preferences
//    int parse_color(const char *str, XColor *xc);
    };

}
